-- this file draw a user interface and link objects with functions

vtgui = {}

function vtgui:Menus()
	gui.title("SourceDreamsVocabularyTest")
	menus = {"Home",
		 "Last test results",
		 "Results sumary",
		 "About this program"}
	gui.menu(menus)
	-- link menu events too navegation function
	gui.sethandler(menuSelect,navegation)
end


function vtgui:ChoseTest()
	gui.destroy()
	screen.clear()
	vtgui:Menus()
	
	gui.nl()
	print("Select the test that you want play")
	gui.nl()

	ut:getTitles() -- set a list of lessons in titles global..

	-- list component
	gui.control{type="list",lines=10, columns=31,list=titles,handler=navegation}

end


function vtgui:testScreen()
	gui.destroy()
	screen.clear()
	vtgui:Menus()
	
	print("Translate...")
	gui.nl()
	-- the first word of test are geted now..
	RandonWord,correctAnswer = ut:getNewWord()
	screen.font(1) -- set as bold
	gui.tab()
	question = gui.label(RandonWord)

	gui.nl()
	userText=gui.field(1,30,100)
	gui.setfocus(userText)
	gui.nl()


	gui.nl()
	gui.nl()
	screen.font(0)
	gui.control{type="button", width=90, text="Verify", handler=navegation}
	gui.control{type="button", width=60, text="Next", handler=navegation}
	gui.nl()
	gui.control{type="button", width=90, text="Solve", handler=navegation}
	gui.control{type="button", width=60, text="Skip", handler=navegation}
	gui.nl()
	gui.nl()
	gui.nl()
	gui.tab(16)
	gui.control{type="button", text="Exit", handler=navegation}

end



function vtgui:lastResults()
	gui.destroy()
	screen.clear()
	vtgui:Menus()
end



function vtgui:resultSumary()
	gui.destroy()
	screen.clear()
	vtgui:Menus()

end



function vtgui:about()
	gui.destroy()
	screen.clear()
	vtgui:Menus()

	text = "This program is a free sofware! \nGPL v2\n"
	text = text.."Developer: Helton Eduardo Ritter\n"
	text = text.."e-mail: heltonritter@gmail.com\n\n"
	text = text.."site: http://code.google.com/p/code4funfiles/\n\n"
	text = text.."Thanks for use :)\n\n "
	text = text.."* Use the menu to back to home screen"	
	
	gui.control{type="field", lines=11, columns=30, text=text}
end
